package com;

public class Car {

	int mode = 0;

	int speed = 0;
	String name;

	private Car createNewCustomCar(String carName)

	{
		Car myCustomeCar = new Car();

		myCustomeCar.name = carName;

		return myCustomeCar;

	}

	protected Car createNewCar(String name, int mode, int speed)

	{

		Car myCar = this.createNewCustomCar(name);

		myCar.mode = mode;
		myCar.speed = speed;

		return myCar;

	}

	public void setName(String name) {
		this.name = name;

	}

	public void start() {
		mode = 1;
	}

	public void move() {

		speed = speed + 5;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + mode;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + speed;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Car other = (Car) obj;
		if (mode != other.mode)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (speed != other.speed)
			return false;
		return true;
	}

	 
	 

}
